package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	words := strings.Split(sc.Text(), " ")

	//words := make([]string, 0)
	//for i := 1000; i <= 3999; i++ {
	//	words = append(words, strconv.Itoa(i))
	//}

	var flag bool
	for _, w := range words {
		if len(w) > 4 {
			//if (w[4] < 'a' || w[4] > 'z') && (w[4] < 'A' || w[4] > 'Z') {
			//	w = w[:4]
			//}
			w = w[:4]
		}
		if len(w) == 4 && w[0] >= '1' && w[0] <= '3' {
			flag = true
			for i := 1; i < 4; i++ {
				if w[i] < '0' || w[i] > '9' {
					flag = false
					break
				}
			}
			if flag {
				fmt.Printf("%s ", w)
			}
		}
	}
}
